package org.langqiao.algorithm;
import java.util.Arrays;
public class CaipiaoXuanhaoqi {

	public void run() { 
		int [] red=new int[6];
		int x=0;
		int blue=(int)(Math.random()*15+1);
	  
		System.out.println("\t"+"福利彩票选号器："+"\n"+"\n"+"\t"+"双色球选号器：\n号码是：");
		System.out.print("红色球是：");
		red[0]=(int)(Math.random()*32+1);
		//System.out.print(red[0]);
		//y1
		outer:for (int i=1;i<red.length ;i++ ) {
			int j=0;
			x++;
			red[i]=(int)(Math.random()*32+1);
			while (j<i) {
				if (red[i]!=red[j]) { 
					j++;
				} else {
					i--;
					//y2 跳到y1处
					continue outer;    
				}
			}
			//System.out.print("  "+red[i]);
		}
		Arrays.sort(red);      //x1
		int y = 0;
		//x2 从x1到x2时进行从小到大的排序！
		while(y < red.length) {
			System.out.print(red[y]+"  ");
			y++;
		}           
		System.out.print("蓝色球是："+blue);
		System.out.println();
		System.out.println("本次结果通过循环"+x+"次，得到结果！");
	 }
	
	 public void run1() {
		 int [] sanD = new int[3];
		 System.out.println();
		 System.out.print("\t"+"3D选号器:\n本次3D号码是：");
		 for (int i = 0;i < sanD.length ; i++) {
			 sanD[i] = (int)(Math.random()*10);
			 System.out.print(sanD[i]+"  ");
		 }	
		 System.out.println("和值是："+(sanD[0]+sanD[1]+sanD[2]));
	 }
	 
	 public void run2() {
		 int [] fengcai = new int [8];
		 int y = 0;
		 fengcai[0] = (int)(Math.random()*35+1);
		 outer:for (int i = 1;i < fengcai.length ;i++ ) {
			 int j = 0;
			 y++;
			 fengcai[i] = (int)(Math.random()*35+1);
			 while (j < i) {
				 if (fengcai[i] != fengcai[j]) { 
					 j++;
				 }  else {
					 i--;
					 //y2 跳到y1处
					 continue outer;    
				 }
			 }
		 }
		 int [] liaoning = new int[]{fengcai[0],fengcai[1],fengcai[2],fengcai[3],fengcai[4],fengcai[5],fengcai[6]};
		 Arrays.sort(liaoning);      //x1
		 int z=0;
		 System.out.println();
		 System.out.print("\t"+"辽宁风采选号器（35选7）：\n号码是：");
		 //x2 从x1到x2时进行从小到大的排序！
		 while(z<liaoning.length) {
			 System.out.print(liaoning[z]+"  ");
			 z++;
		 }           
		 System.out.print("特别号码是："+fengcai[7]);
		 System.out.println();
		 System.out.println("本次结果通过循环"+y+"次，得到结果！");
	 }
	 
	 public void run3() {
		 int [] pl3 = new int[3];
		 System.out.println();
		 System.out.println("\t"+"体育彩票选号器："+"\n");
		 System.out.print("\t"+"体彩排列3选号器:\n本次体彩排列3号码是：");
		 for (int i = 0;i < pl3.length ; i++) {
			 pl3[i] = (int)(Math.random()*10);
			 System.out.print(pl3[i]+"  ");
		 }
	 }
	 
	 public void run4() {
		 int [] pl5 = new int[5];
		 System.out.println("\n");
		 System.out.print("\t"+"体彩排列5选号器:\n本次体彩排列5号码是：");
		 for (int i = 0;i < pl5.length ; i++) {
			 pl5[i] = (int)(Math.random()*10);
			 System.out.print(pl5[i]+"  ");
		 }
	 }
	 
	 public void run5() {
		 int [] pl7 = new int[7];
		 System.out.println("\n");
		 System.out.print("\t"+"体彩7星彩选号器:\n本次体彩7星彩号码是：");
		 for (int i = 0;i < pl7.length ; i++) {
			 pl7[i] = (int)(Math.random()*10);
			 System.out.print(pl7[i]+"  ");
		 }
	 }
	 
	 public void run6() {
		 int [] ty =new int [8];
		 int y=0;
		 ty[0]=(int)(Math.random()*36+1);
		 //y1
		 outer:for (int i=1;i<ty.length ;i++ ) {
			 int j=0;
			 y++;
			 ty[i]=(int)(Math.random()*36+1);
			 while (j<i) {
				 if (ty[i]!=ty[j]) { 
					 j++;
				 } else {
					 i--;
					 continue outer;    //y2 跳到y1处
				 }
			 }
		 }
		 
		 int [] ty1 = new int[]{ty[0],ty[1],ty[2],ty[3],ty[4],ty[5],ty[6]};
		 Arrays.sort(ty1);      //x1
		 int z = 0;
		 System.out.println("\n");
		 System.out.print("\t"+"辽宁体育彩票选号器（36选7）：\n号码是：");
		 //x2 从x1到x2时进行从小到大的排序！
		 while(z<ty1.length) {
			 System.out.print(ty1[z]+"  ");
			 z++;
		 }           
		 System.out.print("特别号码是："+ty[7]);
		 System.out.println();
		 System.out.println("本次结果通过循环"+y+"次，得到结果！");
	 }
	 
	 public void run7() {
		 int [] ty =new int [8];
		 int y=0;
		 ty[0]=(int)(Math.random()*29+1);
		 //y1
		 outer:for (int i=1;i<ty.length ;i++ ) {
			 int j = 0;
			 y++;
			 ty[i] = (int)(Math.random()*29+1);
			 while (j<i) {
				 if (ty[i]!=ty[j]) { 
					 j++;
				 } else {
					 i--;
					 continue outer;  
				 }
			 }
		 }
		 int [] ty1=new int[]{ty[0],ty[1],ty[2],ty[3],ty[4],ty[5],ty[6]};
		 Arrays.sort(ty1);      //x1
		 int z=0;
		 System.out.println("\n");
		 System.out.print("\t"+"辽宁体育彩票选号器（29选7）：\n号码是：");
		 while(z<ty1.length) {
			 System.out.print(ty1[z]+"  ");
			 z++;
		 }           //x2 从x1到x2时进行从小到大的排序！
		 System.out.print("特别号码是："+ty[7]);
		 System.out.println();
		 System.out.println("本次结果通过循环"+y+"次，得到结果！");
	 }
	 
	 public void run8() {
		 int [] ty = new int [5];
		 int y = 0;
		 ty[0] = (int)(Math.random()*22+1);
		 outer:for (int i=1;i<ty.length ;i++ ) {
			 int j = 0;
			 y++;
			 ty[i] = (int)(Math.random()*22+1);
			 while (j<i) {
				 if (ty[i]!=ty[j]) { 
					 j++;
				 } else {
					 i--;
					 continue outer;    
				 }
			 }
		 }
		 
		 Arrays.sort(ty);      //x1
		 int z=0;
		 System.out.println("\n");
		 System.out.print("\t"+"辽宁体育彩票选号器（22选5）：\n号码是：");
		 //x2 从x1到x2时进行从小到大的排序！
		 while(z<ty.length) {
			 System.out.print(ty[z]+"  ");
			 z++;
		 }           
		 System.out.println();
		 System.out.println("本次结果通过循环"+y+"次，得到结果！");
	 }
	  
	 public static void main(String[] args) {
		 CaipiaoXuanhaoqi p = new CaipiaoXuanhaoqi();
		 p.run();    //双色球选号器
		 p.run1();    //3D选号器
		 p.run2();    //辽宁风采选号器（35选7）
		 p.run3();    //体彩排列3选号器
		 p.run4();    //体彩排列5选号器
		 p.run5();    // 体彩7星彩选号器 
		 p.run6();    //辽宁体育彩票选号器（36选7）
		 p.run7();    //辽宁体育彩票选号器（29选7）
		 p.run8();    //辽宁体育彩票选号器（22选5）
	 }
} 
